// 引入 request 方法，假设 request 方法已经定义在某个工具文件中
import request from '/@/utils/request';
import { LogInput,PageExLogInput } from '../models';

// 定义 API 路径枚举
enum Api {
    ClearLogEx = '/SysLogEx/clear',
    LogExDetail = '/SysLogEx/Data?id={id}',
    ExportLogEx = '/SysLogEx/ExportLogEx',
    LogExPage = '/SysLogEx/pages',
}

// 清空异常日志
export const apiSysLogExClearPost = () =>
    request({
        url: Api.ClearLogEx,
        method: 'delete',
    });

// 获取异常日志详情
export const apiSysLogExDetailIdGet = (id: number) =>
    request({
        url: Api.LogExDetail.replace('{id}', id.toString()),
        method: 'get',
    });

// 导出异常日志
export const apiSysLogExExportPost = (body: LogInput) =>
    request({
        url: Api.ExportLogEx,
        method: 'post',
        data: body,
    });

// 获取异常日志分页列表
export const apiSysLogExPagePost = (body: PageExLogInput) =>
    request({
        url: Api.LogExPage,
        method: 'get',
        data: body,
    });